﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using ChinaSoft.Model;
using ChinaSoft.BLL;

namespace MidSoft.Ashx
{
    /// <summary>
    /// LoginAccountToName 的摘要说明
    /// </summary>
    public class LoginAccountToName : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.Buffer = false;
            context.Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
            context.Response.Expires = -1;
            context.Response.AddHeader("Pragma", "No-Cache");
            string UserAccount = context.Request["strUser"].ToString();

            BLL_tb_MidSoft_Users userMgr = new BLL_tb_MidSoft_Users();
            List<Model_tb_MidSoft_Users> listusers = userMgr.GetModelList("UserAccount='" + UserAccount + "'");
            if (listusers.Count > 0)
            {
                if (listusers[0] != null && listusers[0].UserName != null)
                {
                    context.Response.Write(listusers[0].UserName.ToString());
                }
            }
            else
            {
                context.Response.Write("nobody");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}